package org.particlethink.response;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import org.particlethink.entry.DeliverStatus;
import org.particlethink.model.*;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DeliverExportResponse {
    @ExcelProperty("管理层级")
    private String managementLevel; //管理层级
    @ExcelProperty("所属项目")
    private String projectName; //管理层级

    @ExcelProperty("发货单流水号")
    private String no;
    @ExcelProperty("订单编号")
    private String orderNo;

    @ExcelProperty("物料大类")
    private String categoryName;


    @ExcelProperty("车牌号")
    private String carNumber;

    @ExcelProperty("发货时间")
    private String createdAt;//最晚进场时间
    @ExcelProperty("发货人")
    private String creatorName;//创建人
    @ExcelProperty("状态")
    private String status;
    @ExcelProperty("备注")
    private String remark;


    public DeliverExportResponse(
            Deliver deliver,
            Project project,
            Category category,
            SupplierUser creator,
            Acceptance acceptance
    ) {
        this.managementLevel = project.getManagementLevel();
        this.projectName = project.getName();
        this.no = deliver.getNo();
        this.orderNo = deliver.getOrderNo();
        this.categoryName = category == null ? "" : category.getName();
        this.carNumber = acceptance == null ? "" : acceptance.getCarNumber();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");
        this.createdAt = deliver.getCreatedAt() == null ? "" : simpleDateFormat.format(deliver.getCreatedAt());
        this.creatorName = creator == null ? "" : creator.getName();
        this.status = deliver.getStatus().toString();
        this.remark = deliver.getRemark();
    }


    public String getManagementLevel() {
        return managementLevel;
    }

    public void setManagementLevel(String managementLevel) {
        this.managementLevel = managementLevel;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
